from django.shortcuts import render
from .models import User
from article.models import Article,Tag
from django.http import HttpResponse
# Create your views here.
def index(request):
    # author = User(username='91wangfan', password='12qwas')
    # author.save() #User也得记得保存
    # article = Article(title='jinshenmemei',content='asdf')
    # article.author = author
    # article.save()
    # return HttpResponse("添加成功")
    article = Article.objects.first()
    tag1 = Tag.objects.create(name='python')
    tag2 = Tag.objects.create(name='linux')
    article.tags.add(tag1,tag2)
    article.save()
    return HttpResponse("添加成功")